package main

func main() {
	println(isPerfectSquare(1))
}

/**
 *	isPerfectSquare
 *	@Description: 二分
 *	@param num int
 *	@return bool
 */
func isPerfectSquare(num int) bool {
	left := 0
	right := num

	for left <= right {
		mid := (left + right) >> 1
		sqr := mid * mid
		if sqr < num {
			left = mid + 1
			continue
		} else if sqr > num {
			right = mid - 1
			continue
		} else {
			return true
		}
	}
	return false
}
